package com.example.teesystem.controller;

import com.example.teesystem.common.utils.Response;
import com.example.teesystem.entity.vo.violation.ViolationInsertVo;
import com.example.teesystem.entity.vo.violation.ViolationSelectVo;
import com.example.teesystem.service.ViolationService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author pxr
 * @data 2022/4/12 14:57
 */

@RestController
@RequestMapping(value = "/tee/violation" , produces = "application/json; charset=utf-8" )
@RequiredArgsConstructor
public class ViolationController {
    private final ViolationService violationService;

    /**
     * 考试中违规记录
     * @param violationInsertVo
     * @return
     */
    @PostMapping(value = "/addViolation")
    public Response addViolation(@Valid @RequestBody(required = false) ViolationInsertVo violationInsertVo){
        return violationService.insert(violationInsertVo);
    }

    /**
     * 获取违规记录
     * @param violationSelectVo
     * @return
     */
    @PostMapping(value = "/getViolation")
    public Response getViolation(@Valid @RequestBody(required = false) ViolationSelectVo violationSelectVo){
        return violationService.getViolation(violationSelectVo);
    }
}
